﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using myBoard.App.MagnetStore;
using System.ComponentModel;

namespace myBoard.App.Components.MagnetsStore.ViewsModels
{
    public class CategoryViewModel : INotifyPropertyChanged
    {
        internal Category _category;
        private bool _isChecked;
        
        public string Name 
        {
            get
            {
                return _category.Name; 
            }
            set
            {
                _category.Name = value;
                RaisePropertyChanged("Name");
            }
        }

        public int Id 
        {
            get
            {
                return _category.Id;
            }
            set
            {
                _category.Id = value;
                RaisePropertyChanged("Id");
            }
        }

        public bool IsChecked 
        {
            get
            {
                return _isChecked;
            }
            set
            {
                _isChecked = value;
                RaisePropertyChanged("IsChecked");
            }
        }

        private CategoryViewModel()
        {}
        
        public CategoryViewModel(Category category)
        {
            _category = category;
        }        

        private void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }        

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
